﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;
using DeadDog;
using System.Net;
using SC2parser.UserControls;
using SC2parser.Parsing;
using SC2parser.Model;

namespace SC2parser
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            string testname = "mc";
            ImageFetcher playerPortrait = new ImageFetcher();

            if (playerPortrait.FetchImage(testname))
            {
                FileInfo f = new FileInfo(testname);
                if (f.Length > 2000)
                {
                    pbPortrait.Image = Image.FromFile(testname);
                }
            }
            else
            {
                pbPortrait.Image = Properties.Resources._default;
            }

            // MLG: http://wiki.teamliquid.net/starcraft2/index.php?title=2010_MLG_Pro_Circuit/DC&action=edit
            
            //BracketParser mlg = new BracketParser("http://wiki.teamliquid.net/starcraft2/index.php?title=2010_MLG_Pro_Circuit/DC&action=edit");
            //List<Player> Players = new List<Player>(mlg.GetPLayers(mlg.GetSourceMLG()));
            List<Player> Players = new List<Player>();
            /*
            GroupStageParse gsl = new GroupStageParse("http://wiki.teamliquid.net/starcraft2/index.php?title=2012_Global_StarCraft_II_League_Season_3/Code_S/Ro32&action=edit");*/
            //GroupStageParser asusROG = new GroupStageParser("http://wiki.teamliquid.net/starcraft2/index.php?title=ASUS_ROG_The_GD_Invitational&action=edit&section=6");
            
            List<Match> matches = new List<Match>();
            List<Match> test = new List<Match>();
            //matches = gsl.GetMatches(gsl.GetSourceGroups(gsl.LiquipediaPage));
            //test = asusROG.GetMatches(asusROG.GetSourceGroups(asusROG.LiquipediaPage));
            //matches.AddRange(gsl.GetMatches(gsl.GetSourceGroups(new URL("http://wiki.teamliquid.net/starcraft2/index.php?title=2012_Global_StarCraft_II_League_Season_3/Code_S/Ro16&action=edit"))));

            //Players.AddRange(mlg.GetPLayers(mlg.GetSourceGSL(new URL("http://wiki.teamliquid.net/starcraft2/index.php?title=2012_Global_StarCraft_II_League_Season_3/Code_S&action=edit&section=6"))));


        }

        private void adminOverview1_MakePollsBtnClicked(object sender, EventArgs e)
        {
            foreach (Match m in adminOverview1.Matches.GetMatches())
            {
                richTextBox1.Text += m.info();
                richTextBox1.Text += "\n";
            }
        }


    }
}
